# Thrift构建文件
set(POSITION_INDEPENDENT_CODE True)

execute_process(COMMAND thrift --gen cpp -out Client src/Client.thrift
                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
aux_source_directory(Client IPC_CLIENT_SOURCE)
add_library(ClientIPC STATIC ${IPC_CLIENT_SOURCE})
target_link_libraries(ClientIPC PUBLIC thrift)

execute_process(COMMAND thrift --gen cpp -out Algorithm src/Algorithm.thrift
                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
aux_source_directory(Algorithm IPC_ALGORITHM_SOURCE)
add_library(AlgorithmIPC STATIC ${IPC_ALGORITHM_SOURCE})
target_link_libraries(AlgorithmIPC PUBLIC thrift)

add_custom_target(
  Thrift_AlgorithmPython ALL
  COMMAND thrift --gen py -out ../SM_IPCPython src/Algorithm.thrift
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
